#include "Point.h"
#include <iostream>
using namespace std;

class Painter{
private:
	Figure* f;
public:
	Painter(Figure* f);
	//策略的调度
	void draw();

	//改变策略
	void modify(Figure* f) { this->f = f; }
};
Painter::Painter(Figure* f)
	:f(f)

}

void Painter::draw()
{
	if(0 == f)	return ;
	f->onDraw();
}

int main(int argc, char **argv)
{
	Triange triange(Point(2,3), Point(4,5), Point(0,0));

	Circle c(Point(3,3), 10);

	Painter painter(&triange);
	painter.draw();
	painter.modify(&c);
	painter.draw();


	return 0;
}

